Processes Introduction and Management
Processes Introduction and Management
Introduction to Processes :
- processes is Program running in the Background of a system.
- they are Managed by the
Kernel. - the kernel Assign's the Process that has a unique
PIDand it getsincrementedfor the order. Example60th proccess= PID60.
Viewing Process ps ps aux:
ps => display current proccess runed by the user
ps aux => display current proccess runs on the system and all users.
ps:
ps aux:
Important Columns in ps aux:
- USER : the user who initiated the process
- PID : the Process id
- %CPU : CPU usage in %
- COMMAND : the Command that started the Process
Filtering Process use grep:
# in other tab start Metasplolit
msfconsole
ps aux | grep msfconsole
- by using ctrl + shift + F:
- by grep:
Managing Processes:
- Kill and types

- proccess priority with nice
- running poccess in background

- foregrounding proccess

- scheduling process and automation
cronandatoverview
Finding greediest process with top or the modern option htop:
- the
toporhtopcomes in handy if u want to find the greediest process.
top
htop
Note ps vs top:
- ps = ordered by the
pidascending order - top = order by by the
greediest.
Stop (kill) process:
killthis command does what it says it kills the proccess but there are some options they way to end the proccess.- We can stop a proccess by using
topshutdown the proccess by pressingF9and then you have to choose thekill signals. - u can use
kill commandfor faster approachkill [pid]it will preform the default kill options =>SIGTERM.
syntax for kill in terminal:
kill -(n) [pid]
kill -9 1333
SIGKILL
Comman killsignals options:
SIGUP -1 => stops and restart proccess with same id
SIGSTOP -19 => stop/suspend a proccess
SIGINT -2 => the interupt the weakest kill sgnal
SIGQUIT -3 => terminates a proccess the saves it in file named core
SIGTERM -15 => the default kill signal and do clean up tasks
SIGKILL -9 => the absolute kill signal it forces the proccess to s
stop by sending to /dev/null and doesnt do cleanup.
- ex: using
kill commandto Stop a process: am killing my Metasploit sessionkill 91475
ex: Using htop kill a process:
Running process in background:
- This is helpful when u need to open a Tool or Application and use the same terminal session
[tool/application] &
# dont forget[and]
firefox &
ex: mousepad & -> it will this text editor and it will be running in Background.
foregrounding a process :
-
The
fgcommand in Linux brings a background job to the foreground. It lets you continue working with a paused or background-running task in your terminal. -
Just type
fgto resume the most recent job, orfg %job_numberorfg [pid] if it was running in background[&]for a specific one. -
jobscommand to view job and jon number[n].
suspend themsfconsoleby pressingctrl + zthen run fg
command then pressctrl+cto bring the session back to normal
- if thefgonly has on job running in the foreground
-
if running multiple %jobs example use
fg %Job_num:
-
viewing running jobs command
Task and job management Automation (Introduction)
- scheduling process and automation
cronandatoverview - create a small script
- To test
atandcroni wrote simple bash script down below. - create
.shformat andsudo chmod +x script.sh - then execute
./script.sh